import Qt 4.7
import QtQuick 1.0

Item {

  id: button
  property alias label: buttonText.text
  signal clicked()

  width: parent.width
  height: 50

  Rectangle {
    id: buttonRect
    anchors.fill: parent
    radius: 5
    gradient: !mouseArea.pressed ? idleColor : pressedColor
    smooth: true

    Text {
      id: buttonText
      text: "Hello"
      anchors.horizontalCenter: parent.horizontalCenter
      anchors.verticalCenter: parent.verticalCenter
    }
  }

  Gradient {
    id: pressedColor
    GradientStop { position: 0.0; color: "#445" }
    GradientStop { position: 0.1; color: "#556" }
    GradientStop { position: 0.9; color: "#667" }
    GradientStop { position: 1.0; color: "#778" }
  }

  Gradient {
    id: idleColor
    GradientStop { position: 0.0; color: "#ddd" }
    GradientStop { position: 0.1; color: "#ccc" }
    GradientStop { position: 0.8; color: "#999" }
    GradientStop { position: 1.0; color: "#bbb" }
  }

  MouseArea {
    id: mouseArea
    anchors.fill: parent
    onClicked: {
      button.clicked();
    }
  }
}
